//饱汉模式
public class Satiate {
    private static Satiate instance = null;

    public static Satiate getInstance(){
        synchronized (Satiate.class) {//类名.class 返回一个Class类的class对象
            if (instance == null) {
                instance = new Satiate();
            }
            return instance;
        }
    }
}
class Test {
    public static void main(String[] args) {
        Satiate s1 = Satiate.getInstance();
        Satiate s2 = Satiate.getInstance();
        System.out.println(s1 == s2);
    }
}